
load('summary_data/fig3.rda')

out = comp %>% 
  ggplot() +
  aes(x = Wealth_Rank, y = Percent_Change, fill = Year) +
  geom_bar(stat = "identity", position = "dodge") +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
  scale_fill_manual(values = c("Change_2016" = "#EB5149", "Change_2020" = "#7F170E"),
                    labels = c("2012 to 2016", "2012 to 2020")) +
  labs(title = element_blank(),
       x = "Wealth Rank",
       y = element_blank(),
       fill = "Change in Fundraising\nfrom Romney to Trump") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 0, hjust = 0.5),
        axis.text   = element_text(face = "bold", size = 11),
        legend.position = "inside",
        legend.position.inside = c(0.95, 0.95), 
        legend.justification = c(1, 1),
        legend.background = element_rect(fill = "white", color = NA),
        legend.margin = margin(5, 5, 5, 5),
        legend.text = element_text(face = "bold", size = 11),
        legend.title = element_text(face = "bold", size = 12)
  ) +
  scale_y_continuous(labels = scales::percent_format(scale = 1), breaks = c(-75, -50, -25, 0, 25, 50, 75, 100, 125, 150, 175))

ggsave(filename = 'figures/fig3.pdf', plot = out, width = 7, height = 4)
